package org.zjblague.blog.model;

import java.util.List;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.Extensions;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.Order;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.Unique;

import com.google.appengine.api.datastore.Key;

/**
 * <p>
 * Article Tags Entity
 * <p>
 * 
 * @author <a href="mailto:zjblague@gmail.com">Jing Zhang</a>
 * @date
 * @version test
 * 
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Tag {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;

	@Unique
	@Persistent
	private String name;
	
	@Persistent
	private List<Key> articles;
	
	public Tag() {
		super();
	}

	public Tag(String name) {
		super();
		this.name = name;
	}

	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the articles
	 */
	public List<Key> getArticles() {
		return articles;
	}
	
	
	/**
	 * @param articles the articles to set
	 */
	public void setArticles(List<Key> articles) {
		this.articles = articles;
	}
}
